package com.envisioniot.test.service;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.time.Instant;
import java.util.HashMap;
import java.util.Map;

@Service
public class Demo {

    @Cacheable(value = "ScadaTree", key = "#tree", unless = "#result == null")
    public Map getTree(String tree) {
        return new HashMap() {
            {
                put("aa", Instant.now());
            }
        };
    }

    @Cacheable(value = "ScadaTree", unless = "#result == null")
    public Map getTree() {
        return new HashMap() {
            {
                put("aa", Instant.now());
            }
        };
    }
}
